<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\MqProducer;

/**
 * 首页接口.
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页.
     */
    public function index()
    {
        for($i=0; $i<100; $i++){
            $producer  = new MqProducer();//生产者
//            $producer->pushMessage('time:'.time().' your mother call you back home ');
//
            $data = [
                'time'=>time(),
                'title'=> 'fanout->'.rand(1,100),
            ];
            $producer->delayedMessage($data,random_int(10,40));

        }
        $this->success('请求成功');
    }
}
